feat(Telemetry): Emit CLI usage events from an API middleware - #8541
ahmadjafari86 wants to merge 2 commits into
Conversation
|
@ahmadjafari86 is attempting to deploy a commit to the Flagsmith Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe API adds and registers Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 9a2f8873-0c9a-48ca-8fb5-d296c575e914
📒 Files selected for processing (4)
api/app/settings/common.pyapi/telemetry/middleware.pyapi/tests/unit/telemetry/test_unit_telemetry_middleware.pydocs/docs/deployment-self-hosting/observability/_events-catalogue.md
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Closes #8319
Flagsmith CLI requests currently don't emit dedicated usage telemetry. This adds middleware to record authenticated CLI usage so it can be observed consistently without introducing database or cache reads in the telemetry path.
cli.request.madefor authenticated CLI requests.Review effort: 2/5
How did you test this code?
Added unit tests covering authenticated and unauthenticated requests, Master API Keys, error responses, CLI version passthrough, non-CLI User-Agents, and zero database queries during CLI telemetry handling.
Also verified with: